% construct diffusion and random force part
function rest = randomtest(t,y,para,casenum)

load('alphas'); load('msval');
num=para(1);alphaK=para(2);
dt1=0.5/num; 
t2index=floor((t+0.5*dt1)/dt1)+1;
switch casenum
    case 1
        myfun=@(s) 1+s-s;
        alpharow=size(alphas,1);
        row=alpharow;
        if row >=2
            rest(row)=0;
        end
        rest(1)=0;
        rest(2:alphaK+1)=myfun(t)*msval(t2index,1:alphaK);
        case 2
        myfun=@(s) sin(s);
        alpharow=size(alphas,1);
        row=alpharow;
        if row >=2
            rest(row)=0;
        end
        rest(1)=0;
        rest(2:alphaK+1)=myfun(t)*msval(t2index,1:alphaK);
        case 3
        myfun=@(s) sin(5*s);
        alpharow=size(alphas,1);
        row=alpharow;
        if row >=2
            rest(row)=0;
        end
        rest(1)=0;
        rest(2:alphaK+1)=myfun(t)*msval(t2index,1:alphaK);
        case 4
        myfun=@(s) sin(30*s);
        alpharow=size(alphas,1);
        row=alpharow;
        if row >=2
            rest(row)=0;
        end
        rest(1)=0;
        rest(2:alphaK+1)=myfun(t)*msval(t2index,1:alphaK);
    case 5
        myfun=@(s) sin(exp(5*t));
        alpharow=size(alphas,1);
        row=alpharow;
        if row >=2
            rest(row)=0;
        end
        rest(1)=0;
        rest(2:alphaK+1)=myfun(t)*msval(t2index,1:alphaK);
end
rest=rest';



